﻿
'****************************************************
'功能說明：底層網頁
'建立人員：andy
'建立日期：2011/1/27
'****************************************************
Imports Microsoft.VisualBasic
Imports System.Collections
Imports System.Collections.Generic
Imports System.Data.SqlClient
Imports System.Threading
Imports System.Globalization
Imports System.Resources
Imports System.Data
Public Class BasePage
    Inherits System.Web.UI.Page

    Public Sub SetUserLanguage(ByVal UI_Culuter As String)
        Session("GlobalLanguage") = UI_Culuter

    End Sub

    Protected Overridable Function SaveData() As Boolean
        Return True
    End Function

    ''' <summary>
    ''' 取得根目錄的路徑名稱
    ''' </summary>
    ''' <value></value>
    ''' <returns>取得根目錄的路徑名稱</returns>
    ''' <remarks>取得根目錄的路徑名稱</remarks>
    Public ReadOnly Property BaseUrl() As String
        Get
            Dim url As String = Me.Request.ApplicationPath
            If url.EndsWith("/") Then
                Return url
            Else
                Return url + "/"
            End If
        End Get
    End Property

    ''' <summary>
    ''' 取得相對網址不包含server 和 QueryString
    ''' </summary>
    ''' <value></value>
    ''' <returns>取得相對網址不包含server 和 QueryString</returns>
    ''' <remarks>取得相對網址不包含server 和 QueryString</remarks>
    Public ReadOnly Property FullBaseUrl() As String
        Get
            'Return Me.Request.Url.AbsoluteUri.Replace(Me.Request.Url.PathAndQuery, "") + Me.BaseUrl
            Return Me.Request.Url.AbsolutePath
        End Get
    End Property

    ''' <summary>
    ''' 取得網址全部資訊
    ''' </summary>
    ''' <value></value>
    ''' <returns>取得網址全部資訊</returns>
    ''' <remarks>取得網址全部資訊</remarks>
    Public ReadOnly Property FullBaseUrlPathAndQuery() As String
        Get
            'Return Me.Request.Url.AbsoluteUri.Replace(Me.Request.Url.PathAndQuery, "") + Me.BaseUrl
            Return Me.Request.Url.PathAndQuery
        End Get
    End Property

    ''' <summary>
    ''' 要求到登入畫面
    ''' </summary>
    ''' <remarks>要求到登入畫面</remarks>
    Public Sub RequestLogin()
        Response.Redirect("~/Login.aspx")
    End Sub
    Protected Property dbName() As String
        Get
            If Session("dbName") = Nothing Then
                RequestLogin()
            End If
            Return CType(Session("dbName"), String)
            'Return "AA"
        End Get
        Set(ByVal value As String)
            Session("dbName") = value
        End Set
    End Property

    ''' <summary>
    ''' 取得語言設定值
    ''' </summary>
    ''' <returns>取得語言設定值</returns>
    ''' <remarks>取得語言設定值</remarks>
    Public Function GetUserLanguage() As String
        If IsNothing(Session("GlobalLanguage")) Then
            RequestLogin()
            Return Session("GlobalLanguage").ToString()
        Else
            Return Session("GlobalLanguage").ToString()
        End If

    End Function

    Public Function GetTheme() As String
        If IsNothing(Session("Theme")) Then
            RequestLogin()
            Return Session("Theme").ToString()
        Else
            Return Session("Theme").ToString()
        End If

    End Function
    Public Function GetMenuCollapsible() As String
        If IsNothing(Session("MenuCollapsible")) Then
            RequestLogin()
            Return Session("MenuCollapsible").ToString()
        Else
            Return Session("MenuCollapsible").ToString()
        End If

    End Function
    Public Function GetWinTargetBlank() As String
        If IsNothing(Session("WinTargetBlank")) Then
            RequestLogin()
            Return Session("WinTargetBlank").ToString()
        Else
            Return Session("WinTargetBlank").ToString()
        End If

    End Function



    ''' <summary>
    ''' 設定語言
    ''' </summary>
    ''' <remarks>設定語言</remarks>
    Protected Overrides Sub InitializeCulture()

        Dim sl As String = GetUserLanguage()
        Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(sl)
        Thread.CurrentThread.CurrentUICulture = New CultureInfo(sl)
    End Sub

    ''' <summary>
    ''' 啟動程式時把目前該程式的權限放到ViewStatues中
    ''' </summary>
    ''' <param name="e"></param>
    ''' <remarks>啟動程式時把目前該程式的權限放到ViewStatues中</remarks>
    Protected Overrides Sub OnPreInit(ByVal e As System.EventArgs)

        If UID = "" Then
            RequestLogin()
        End If
        EnterToTab(Me)
        ''以代理人的UID檢查權限.//利於將來可以有代理人的機制//ActualUID是登入者的UID//
        ReadRights(UID, Me.AppRelativeVirtualPath.ToString())

        If (IsPostBack) Then

        Else

         

            If FullBaseUrl.ToUpper.IndexOf("PopupForm.aspx".ToUpper) = -1 Then
                If Session("ProgramMenu") = True Then
                    Dim sb As StringBuilder = New StringBuilder()
                    sb.AppendLine("    if ( window.parent.frames[1]==null) {window.location.replace('" + Me.ResolveUrl("~/WebForm/Main/MainPage.aspx?ptah=") + FullBaseUrlPathAndQuery + "');} ")
                    RunClientScriptForAjax(Me.Page, sb.ToString())
                End If

            End If

            If Session("Theme") IsNot Nothing Then
                
                Me.Theme = Session("Theme").ToString()
            Else
                
                Session("Theme") = GetTheme()
                Me.Theme = GetTheme()
            End If
          
        End If
        MyBase.OnPreInit(e)
    End Sub

   

    ''' <summary>
    ''' 取得代理人姓名,若未代理時則和登入的人同樣
    ''' </summary>
    ''' <value></value>
    ''' <returns> 取得代理人姓名,若未代理時則和登入的人同樣</returns>
    ''' <remarks> 取得代理人姓名,若未代理時則和登入的人同樣</remarks>
    Protected Property UserName() As String
        Get
            If Session("UserName") = Nothing Then
                RequestLogin()
            End If

            Return CType(Session("UserName"), String)
        End Get
        Set(ByVal value As String)
            Session("UserName") = value
        End Set

    End Property


    ''' <summary>
    ''' 取得代理人UID,若未代理時則和登入的人同樣
    ''' </summary>
    ''' <value></value>
    ''' <returns>取得代理人UID,若未代理時則和登入的人同樣</returns>
    ''' <remarks>取得代理人UID,若未代理時則和登入的人同樣</remarks>
    Protected Property UID() As String
        Get
            If Session("UID") = Nothing Then
                RequestLogin()
            End If
            Return CType(Session("UID"), String)
            'Return "AA"
        End Get
        Set(ByVal value As String)
            Session("UID") = value
        End Set
    End Property

    ''' <summary>
    ''' 取得登入者姓名
    ''' </summary>
    ''' <value></value>
    ''' <returns>取得登入者姓名</returns>
    ''' <remarks>取得登入者姓名</remarks>
    Protected ReadOnly Property ActualUserName() As String
        Get
            If Session("ActualUserName") = Nothing Then
                RequestLogin()
            End If

            Return CType(Session("ActualUserName"), String)
        End Get

    End Property

    ''' <summary>
    ''' 取得登入者UID
    ''' </summary>
    ''' <value></value>
    ''' <returns>取得登入者UID</returns>
    ''' <remarks>取得登入者UID</remarks>
    Protected ReadOnly Property ActualUID() As String
        Get
            If Session("ActualUID") = Nothing Then
                RequestLogin()
            End If
            Return CType(Session("ActualUID"), String)
        End Get
    End Property

    ''' <summary>
    ''' 秀出訊息
    ''' </summary>
    ''' <param name="msg"></param>
    ''' <remarks>秀出訊息</remarks>
    Public Sub ShowMessage(ByVal msg As String)
     
        Dim script As String
        script = "<script language=JavaScript>  if (window.parent.frames[""framSplit""]!=null ) { window.parent.frames[""framSplit""].document.getElementById(""txtMessaage"").value ='" + msg.Replace("'", "").Replace("""", "\""").Replace(vbCrLf, "\n\r") + "'; } else { "
        script += "alert('" & msg.Replace("'", "").Replace("""", "\""").Replace(vbCrLf, "\n\r") & "'); }</script>"
        Page.ClientScript.RegisterClientScriptBlock(GetType(BasePage), "ShowMessage" + GetNewKey("RSCA"), script)
    End Sub

    ''' <summary>
    ''' 有UpdatePanel時秀出訊息
    ''' </summary>
    ''' <param name="obj"></param>
    ''' <param name="Msg"></param>
    ''' <remarks>有UpdatePanel時秀出訊息</remarks>
    Public Shared Sub ShowMessageForAjax(ByVal obj As Object, ByVal Msg As String)
        Dim script As String
        script = " if (window.parent.frames[""framSplit""]!=null ) { window.parent.frames[""framSplit""].document.getElementById(""txtMessaage"").value ='" + Msg.Replace("'", "").Replace("""", "\""").Replace(vbCrLf, "\n\r") + "'; } else { "
        script += "alert('" & Msg.Replace("'", "").Replace("""", "\""").Replace(vbCrLf, "\n\r") & "'); }"
        ' script += "alert('" & Msg.Replace("'", "").Replace("\", "\\").Replace("""", "\""").Replace(vbCrLf, "\n\r") & "'); "

        ScriptManager.RegisterStartupScript(obj, GetType(BasePage), "ShowMessage" + GetNewKey("RSCA"), script, True)


    End Sub

    '===========================================
    ''' <summary>
    ''' Enter鍵可移動游標
    ''' </summary>
    ''' <param name="page">網頁</param>
    ''' <remarks>Enter鍵可移動游標</remarks>
    Public Sub EnterToTab(ByVal page As System.Web.UI.Page)
        Dim sb As New StringBuilder()
        Dim vbCrLf As String = "" & Chr(13) & ""
        sb.Append(vbCrLf)
        sb.Append("<script>" + vbCrLf)
        sb.Append("document.onkeydown = _keyCode;" + vbCrLf)
        sb.Append("function _keyCode()" + vbCrLf)
        sb.Append("{" + vbCrLf)
        sb.Append("  if(event.srcElement.tagName!='TEXTAREA')" + vbCrLf)
        sb.Append("    if(event.keyCode==13)" + vbCrLf)
        sb.Append("    {" + vbCrLf)
        sb.Append("      event.keyCode=9;" + vbCrLf)
        sb.Append("    }" + vbCrLf)
        sb.Append("}" + vbCrLf)
        sb.Append("</script>" + vbCrLf)
        page.ClientScript.RegisterStartupScript(GetType(BasePage), "changeTab", sb.ToString())

    End Sub

    ''' <summary>
    ''' 檢查是否有權限
    ''' </summary>
    ''' <param name="UserID"></param>
    ''' <param name="strURL"></param>
    ''' <returns>檢查是否有權限</returns>
    ''' <remarks>檢查是否有權限</remarks>
    Protected Function ReadRights(ByVal UserID As String, ByVal strURL As String) As Boolean

      





        Dim URLQueryString As String = "~" + Me.FullBaseUrlPathAndQuery().Substring(Me.FullBaseUrlPathAndQuery.IndexOf("/", 2))
      


        '/==========================================================
        ReadRights = False
        Dim dt As DataTable
        Dim dao As OAMS.DAO.UsersDAO = New OAMS.DAO.UsersDAO(dbName)
        dt = dao.GetURLRights(strURL, URLQueryString, UserID)
        Dim ii As Integer = 0
        For ii = 1 To 99

            Try
                Session.Remove("ProgramRight_" + ii.ToString())
            Catch ex As Exception
            End Try
        Next


        ii = 0

        Session("ProgramMenu") = False
        For Each dr As DataRow In dt.Rows
            Session("ProgramRight_" + dr("SeqNo").ToString()) = True
            If dr("isMenu").ToString.ToUpper = "TRUE" Or dr("isMenu").ToString.ToUpper = "1" Then
                Session("ProgramMenu") = True
            End If
            ReadRights = True
        Next
        If strURL.ToUpper.IndexOf("popupform.aspx".ToUpper) = -1 Then
            If strURL.ToUpper.IndexOf("~/WebForm/Main/Banner.aspx".ToUpper) = -1 Then
                If strURL.ToUpper.IndexOf("~/WebForm/Main/Menu.aspx".ToUpper) = -1 Then
                    If strURL.ToUpper.IndexOf("~/WebForm/Main/MainPage.aspx".ToUpper) = -1 Then
                        If strURL.ToUpper.IndexOf("~/WebForm/Main/MainPage1.aspx".ToUpper) = -1 Then
                            If dt.Rows.Count = 0 Then
                                Me.Visible = False
                                ShowMessage("NoPermission")
                            End If
                        End If
                    End If

                End If

            End If
        End If

    End Function

    ''' <summary>
    ''' 檢查該程式中的某1個功能是否有權限(可以用SeqNo可以查得到是否有權限)
    ''' </summary>
    ''' <param name="SeqNo">可以用SeqNo可以查得到是否有權限</param>
    ''' <returns>檢查該程式中的某1個功能是否有權限(可以用SeqNo可以查得到是否有權限)</returns>
    ''' <remarks>檢查該程式中的某1個功能是否有權限(可以用SeqNo可以查得到是否有權限)</remarks>
    Protected Function ChkProgramRight(ByVal SeqNo As String) As Boolean
        'If IsNothing(Session("ProgramRight_" & SeqNo)) Then '沒有值代表沒有權限
        '    Return False
        'Else
        '    Return True
        'End If
        If IsNothing(Session("ProgramRight_" + SeqNo)) Then '沒有值代表沒有權限
            Return False
        Else
            Return True
        End If

    End Function

    ''' <summary>
    ''' 處理程式沒有攔到錯誤的地方,不要秀出原始檔等相關的頁面出來
    ''' </summary>
    ''' <param name="e"></param>
    ''' <remarks>處理程式沒有攔到錯誤的地方,不要秀出原始檔等相關的頁面出來</remarks>
    Protected Overrides Sub OnError(ByVal e As System.EventArgs)
        Dim ex As Exception = Server.GetLastError
        Dim Msg As String '= ex.Message
        Msg = GetInnerException(ex, ".OnError")
        ' Prmpt Msg
        Response.Write("<script language=""javascript"">alert(""" & Msg.Replace("\", "\\").Replace(vbCrLf, "\r\n").Replace("""", "'") & """)</Script>")
      
        Server.ClearError()
        MyBase.OnError(e)
    End Sub

    ''' <summary>
    ''' 取出錯誤的相關訊息
    ''' </summary>
    ''' <param name="ex"></param>
    ''' <param name="Source"></param>
    ''' <param name="Params"></param>
    ''' <returns> 取出錯誤的相關訊息</returns>
    ''' <remarks> 取出錯誤的相關訊息</remarks>
    Public Shared Function GetInnerException(ByVal ex As Exception, ByVal Source As String, ByVal ParamArray Params As String()) As String
        Dim strMsg As New StringBuilder()
        Dim strLogMsg As New StringBuilder()
        Dim strKey As String = Date.Now.ToString("yyyyMMddHHmmss") & Now.Millisecond.ToString("000")
        Dim strOtherMsg As String = ""

        If Params.Length > 0 Then
            For Each s As String In Params
                strOtherMsg &= ", " & s
            Next
        End If

        If strOtherMsg.Length > 2 Then strOtherMsg = strOtherMsg.Substring(2)
        strLogMsg.AppendLine(String.Format("Source:[{0}], Key={1}", Source, strKey))

        If TypeOf ex Is System.Data.SqlClient.SqlException Then
            For Each er As System.Data.SqlClient.SqlError In CType(ex, System.Data.SqlClient.SqlException).Errors
                strLogMsg.AppendLine(er.ToString())
                strMsg.AppendLine(er.Message.ToString())
            Next
        Else
            strLogMsg.AppendLine(ex.ToString())
            strMsg.AppendLine(ex.Message.ToString())
        End If

        strMsg.AppendLine("(" & strKey & ")")
        If strOtherMsg = "" Then strLogMsg.AppendLine(strOtherMsg)
        'WriteLog(strLogMsg.ToString(), LogType.Error)

        Return String.Format("[{0}]：{1}", Source, strMsg.ToString())
    End Function
   


    ''' <summary>
    ''' 有UpdatePanel時開啟選取視窗,傳回值,如為ReadOnly或者Enabled=False則postBack後會恢復之前的狀態,需注意
    ''' </summary>
    ''' <param name="obj">傳入網頁上之任一webControl均可</param>
    ''' <param name="FieldsName">要秀出在視窗中的資料欄位</param>
    ''' <param name="ChnFieldNames">欄位的中文名稱</param>
    ''' <param name="tableName">資料表名稱</param>
    ''' <param name="dbName">連線字串的設定名稱</param>
    ''' <param name="returnFields">回傳欄位的順序號例1,3代表回第1及第3個欄位值中間以','分開</param>
    ''' <param name="returnControls">回傳的頁面webControl.ClientID,如傳回多個則中間以','分開</param>
    ''' <param name="feature">開啟視窗的外觀樣式</param>
    ''' <remarks> 有UpdatePanel時開啟選取視窗,傳回值,如為ReadOnly或者Enabled=False則postBack後會恢復之前的狀態,需注意</remarks>
    Public Sub PopupFormForAjax(ByVal obj As Object, ByVal FieldsName As String, ByVal ChnFieldNames As String, ByVal tableName As String _
                              , ByVal dbName As String, ByVal returnFields As String, ByVal returnControls As String, ByVal feature As String)

        Session("FieldsName") = FieldsName
        Session("ChnFieldNames") = ChnFieldNames
        Session("tableName") = tableName
        Session("dbName") = dbName
        Session("returnFields") = returnFields
        Session("returnControls") = returnControls

        Dim sb As New StringBuilder()
        Dim vbCrLf As String = "" & Chr(13) & ""
        sb.Append(vbCrLf)
        sb.Append("<script>" + vbCrLf)
        sb.Append("var w ; w=window.open('" & Me.ResolveUrl("~/Webform/PopForm/PopupForm.aspx") & "','aa','" & feature & "'); w.focus();")
        sb.Append("</script>" + vbCrLf)

        ScriptManager.RegisterStartupScript(obj, GetType(BasePage), "PopForm", sb.ToString(), False)


    End Sub


    Public Sub PopupFormForAjax(ByVal obj As Object, ByVal FieldsName As String, ByVal ChnFieldNames As String, ByVal dbTable As DataTable _
                             , ByVal dbName As String, ByVal returnFields As String, ByVal returnControls As String, ByVal feature As String)

        Session("FieldsName") = FieldsName
        Session("ChnFieldNames") = ChnFieldNames
        Session("tableName") = ""
        Session("dbName") = dbName
        Session("returnFields") = returnFields
        Session("returnControls") = returnControls
        Session("dbTable") = dbTable
        Dim sb As New StringBuilder()
        Dim vbCrLf As String = "" & Chr(13) & ""
        sb.Append(vbCrLf)
        sb.Append("<script>" + vbCrLf)
        sb.Append("var w ; w=window.open('" & Me.ResolveUrl("~/Webform/PopForm/PopupForm.aspx") & "','aa','" & feature & "'); w.focus();")
        sb.Append("</script>" + vbCrLf)

        ScriptManager.RegisterStartupScript(obj, GetType(BasePage), "PopForm", sb.ToString(), False)


    End Sub


    Public Sub PopupFormForAjax(ByVal obj As Object, ByVal FieldsName As String, ByVal ChnFieldNames As String, ByVal dbTable As DataTable _
                             , ByVal dbName As String, ByVal returnFields As String, ByVal returnControls As String, ByVal feature As String, ByVal PopMsg As String)

        Session("FieldsName") = FieldsName
        Session("ChnFieldNames") = ChnFieldNames
        Session("tableName") = ""
        Session("dbName") = dbName
        Session("returnFields") = returnFields
        Session("returnControls") = returnControls
        Session("dbTable") = dbTable
        Session("PopMsg") = PopMsg
        Dim sb As New StringBuilder()
        Dim vbCrLf As String = "" & Chr(13) & ""
        sb.Append(vbCrLf)
        sb.Append("<script>" + vbCrLf)
        sb.Append("var w ; w=window.open('" & Me.ResolveUrl("~/Webform/PopForm/PopupForm.aspx") & "','aa','" & feature & "'); w.focus();")
        sb.Append("</script>" + vbCrLf)

        ScriptManager.RegisterStartupScript(obj, GetType(BasePage), "PopForm", sb.ToString(), False)


    End Sub

    ''' <summary>
    ''' 在沒有UpdatePanel 網頁中,開啟選取視窗,傳回值,如為ReadOnly或者Enabled=False則postBack後會恢復之前的狀態,需注意
    ''' </summary>
    ''' <param name="FieldsName">要秀出在視窗中的資料欄位</param>
    ''' <param name="ChnFieldNames">欄位的中文名稱</param>
    ''' <param name="tableName">資料表名稱</param>
    ''' <param name="dbName">連線字串的設定名稱</param>
    ''' <param name="returnFields">回傳欄位的順序號例1,3代表回第1及第3個欄位值中間以','分開</param>
    ''' <param name="returnControls">回傳的頁面webControl.ClientID,如傳回多個則中間以','分開</param>
    ''' <param name="feature">開啟視窗的外觀樣式</param>
    ''' <remarks>在沒有UpdatePanel 網頁中, 開啟選取視窗,傳回值,如為ReadOnly或者Enabled=False則postBack後會恢復之前的狀態,需注意</remarks>
    Public Sub PopupForm(ByVal FieldsName As String, ByVal ChnFieldNames As String, ByVal tableName As String _
                              , ByVal dbName As String, ByVal returnFields As String, ByVal returnControls As String, ByVal feature As String)

        Session("FieldsName") = FieldsName
        Session("ChnFieldNames") = ChnFieldNames
        Session("tableName") = tableName
        Session("dbName") = dbName
        Session("returnFields") = returnFields
        Session("returnControls") = returnControls

        Dim sb As New StringBuilder()

        sb.AppendLine()
        sb.AppendLine("<script>")
        sb.AppendLine("var w ; w=window.open('" & Me.ResolveUrl("~/Webform/PopForm/PopupForm.aspx") & "','aa','" & feature & "'); w.focus();")
        sb.AppendLine("</script>")

        ' ScriptManager.RegisterStartupScript(obj, GetType(BasePage), "PopForm", sb.ToString(), False)

        Page.ClientScript.RegisterClientScriptBlock(GetType(BasePage), "PopForm", sb.ToString())

    End Sub

    Public Sub PopupForm(ByVal FieldsName As String, ByVal ChnFieldNames As String, ByVal dbTable As DataTable _
                             , ByVal dbName As String, ByVal returnFields As String, ByVal returnControls As String, ByVal feature As String)

        Session("FieldsName") = FieldsName
        Session("ChnFieldNames") = ChnFieldNames
        Session("tableName") = ""
        Session("dbName") = dbName
        Session("returnFields") = returnFields
        Session("returnControls") = returnControls
        Session("dbTable") = dbTable

        Dim sb As New StringBuilder()

        sb.AppendLine()
        sb.AppendLine("<script>")
        sb.AppendLine("var w ; w=window.open('" & Me.ResolveUrl("~/Webform/PopForm/PopupForm.aspx") & "','aa','" & feature & "'); w.focus();")
        sb.AppendLine("</script>")

        ' ScriptManager.RegisterStartupScript(obj, GetType(BasePage), "PopForm", sb.ToString(), False)

        Page.ClientScript.RegisterClientScriptBlock(GetType(BasePage), "PopForm", sb.ToString())

    End Sub


#Region "GetNewKey : 取的唯一的名稱"
    ''' <summary>
    ''' 取的唯一的名稱
    ''' </summary>
    ''' <param name="Kind">Prefix name</param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared Function GetNewKey(ByVal Kind As String) As String
        Randomize()
        Dim intRandomNumber As Integer = Rnd() * 100000
        Return Kind & Now.ToString("yyyyMMddHHmmss") & Now.Millisecond.ToString("000") & intRandomNumber.ToString()
    End Function


#End Region
#Region "runClientScript:從Server端寫出Client端執行的程式碼"
    Public Shared Sub RunClientScript(ByVal obj As Object, ByVal Script As String)
        Dim cMsgr As ClientScriptManager = CType(obj, Page).ClientScript
        Dim strKey As String = GetNewKey("RCS")
        cMsgr.RegisterStartupScript(obj.GetType, strKey, Script, True)
    End Sub

    Public Shared Sub RunClientScriptForAjax(ByVal obj As Page, ByVal Script As String)
        Dim strKey As String = GetNewKey("RSCA")
        ScriptManager.RegisterStartupScript(obj, obj.GetType(), strKey, Script, True)
    End Sub
#End Region

    Public Sub objSetFocus(ByVal obj As System.Web.UI.WebControls.WebControl)
        RunClientScriptForAjax(Me.Page, "setTimeout(""$get('" & obj.ClientID & "').focus(); "", 10);")

    End Sub


    Public Sub WriteErrorLog(ByVal FunctionName As String, ByVal errMsg As String, ByVal errStatus As String)
        'Dim dao1 As New ACMS.DAO.BaseDAO()
        'dao1.ErrorLog(Me.Request.Url.AbsolutePath, errMsg, FunctionName, clsAuth.WORK_ID + clsAuth.NATIVE_NAME, errStatus)
        'clsMyObj.ShowMessage(errMsg.Replace("'", ""))
    End Sub


End Class
